package cn.topevery.garden.dal.logic;

import cn.topevery.garden.dal.dao.OcaInfoDao;
import cn.topevery.garden.entity.fetch.OcaFetch;
import cn.topevery.garden.entity.po.OcaInfo;
import cn.topevery.garden.entity.query.OcaInfoQuery;
import cn.topevery.garden.entity.vo.OcaInfoVO;
import cn.topevery.garden.framework.base.BaseLogic;
import hw.topevery.framework.db.base.BaseEntityDao;
import hw.topevery.framework.db.entity.DataPager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 绿地占用信息表
 *
 * @author code-generate
 * @date 2022-01-05
 */
@Service
public class OcaInfoLogic extends BaseLogic<OcaInfo> {
    @Autowired
    OcaInfoDao ocaInfoDao;

    @Override
    public BaseEntityDao<OcaInfo, Integer> getDao() {
        return ocaInfoDao;
    }



    /**
     * 获取列表
     *
     * @param query
     */
    public DataPager<OcaInfoVO> listPage(OcaInfoQuery query) {
        return ocaInfoDao.listPage(query);
    }

    /**
     * 根据自增id批量删除
     *
     * @param ids
     */
    public void deleteBatchById(String userId,Integer[] ids) {
        ocaInfoDao.delete(userId, ids);
    }

    /**
     * 根据自增id保存或者更新
     *
     * @param ocaInfo 实体
     */
    public void saveOrUpdate(String userId, OcaInfo ocaInfo){
        ocaInfoDao.saveOrUpdate(userId,ocaInfo);
    }

    /**
         * 根据自定义列值来获取对象
         */
    public OcaInfo getEntityByColumn(String key, String value) {
        return ocaInfoDao.getEntityByColumn(key, value);
    }

    public DataPager<OcaInfo> getList(OcaFetch ocaFetch) {
        return ocaInfoDao.getList(ocaFetch);
    }

    public OcaInfo getById(Integer id) {
        return ocaInfoDao.getById(id);
    }

    public void updateByIds(List<Integer> ids) {
        ocaInfoDao.updateByIds(ids);
    }
}
